package threadmethodcall;

/**
 * @description:
 * @author: jhy
 * @time: 2021/4/12 16:53
 */


//线程的构造方法、静态块是被new这个线程的线程调用的，只有他的run方法，才是被他自己调用的
public class ThreadMethodCallDemo1 {

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        myThread.setName("A");
        myThread.start();
    }

}

class MyThread extends Thread{

    public MyThread(){
        System.out.println(Thread.currentThread().getName() + "调用了A线程的构造方法");
    }

    {
        System.out.println(Thread.currentThread().getName() + "调用了A线程的静态块");
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "调用了A线程的run方法");
    }
}

